#ifndef DISKSIZETABLE_H
#define DISKSIZETABLE_H

#include <QTableWidget>
#include <QColor>
#include <QProcess>
#include <QHeaderView>
#include <QDir>
#include <QFileInfo>
#include <QFileInfoList>
#include <QDebug>
#include <QProgressBar>

class DiskSizeTable : public QTableWidget
{
    Q_OBJECT

public:
    DiskSizeTable(QWidget *parent = 0);

    QColor getBgColor()         const;
    QColor getChunckColor1()    const;
    QColor getChunckColor2()    const;
    QColor getChunckColor3()    const;
    QColor getTextColor1()      const;
    QColor getTextColor2()      const;
    QColor getTextColor3()      const;

    QSize sizeHint()            const;
    QSize minimumSizeHint()     const;

public slots:
    //载入容量
    void load();
    //设置背景颜色
    void setBgColor(QColor &bgColor);

    //设置进度颜色
    void setChunckColor1(const QColor &chunckColor);
    void setChunckColor2(const QColor &chunckColor);
    void setChunckColor3(const QColor &chunckColor);

    //设置文字颜色
    void setTextColor1(const QColor &textColor);
    void setTextColor2(const QColor &textColor);
    void setTextColor3(const QColor &textColor);

private slots:
    void readData();
    void checkSize(const QString &result, const QString &name);
    void insertSize(const QString &name, const QString &use, const QString &free, const QString &all, int percent);

Q_SIGNALS:
    void sdcardReceive(const QString &sdcardName);
    void udiskReceive(const QString &udiskName);

private:
    QProcess *process;          //执行命令进程

    QColor bgColor;             //背景颜色
    QColor chunkColor1;         //进度颜色1
    QColor chunkColor2;         //进度颜色2
    QColor chunkColor3;         //进度颜色3
    QColor textColor1;          //文字颜色1
    QColor textColor2;          //文字颜色2
    QColor textColor3;          //文字颜色3
};

#endif // DISKSIZETABLE_H
